const ffmpeg = require('fluent-ffmpeg'),
  fs = require('fs'),
  log = require('../util/log')

ffmpeg('D:\\Program Files\\nodejs\\private\\zoro\\zoro\\dist\\media\\20170805.mp4')
// .videoBitrate(1024)// set video bitrate
// .aspect('16:9')// set aspect ratio
  .size('50%')// set size in percent
  .fps(10)// set fps
  .audioBitrate('32k')// set audio bitrate
  // .audioCodec('libmp3lame')// set audio codec
  // .audioChannels(2)// set number of audio channels
  // .addOption('-vtag', 'DIVX')// set custom option
  // .format('avi')// set output format to force
  .on('end', function () {// setup event handlers
    log('file has been converted succesfully');
  })
  .on('error', function (err) {
    log('an error happened: ', err);
  })
  // .save('C:\\Users\\Administrator\\Desktop\\outtest.mp4');// save to file
  .pipe(fs.createWriteStream('C:\\Users\\Administrator\\Desktop\\outtest.mp4'), {end: true})
